package com.laowang.utils;

import javax.persistence.criteria.CriteriaBuilder;
import java.util.Random;

/**
 * Created by Administrator on 2019/1/11.
 */
public class KeyUtil {
    /***
     * 生成唯一的主键
     *格式：时间+随机数
     *
     */
    public static synchronized String getUniqueKey(){
        Random random = new Random();

        Integer number = random.nextInt(900000)+100000;
        return String.valueOf(number) + System.currentTimeMillis();
    }

}
